/*
* Copyright (C) 2008-2009 J-P Nurmi jpnurmi@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* $Id: mainwindow.h 318 2009-02-22 20:35:11Z vjousse $
*/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "server.h"
#include "ui_mainwindow.h"
#include <QSystemTrayIcon>

class Controller;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    static MainWindow* instance();

    Viewer* viewer() const;
    QTreeView* viewTree() const;
    QListView* nickList() const;

	void setController(Controller* aController);

protected:
    void closeEvent(QCloseEvent* event);

private slots:
    void on_actionConnect_triggered();
    void on_actionDisconnect_triggered();
    void on_actionQuit_triggered();
    void on_actionFindText_triggered();
    void on_actionFindNext_triggered();
    void on_actionFindPrevious_triggered();
    void on_actionClearWindow_triggered();
    void on_actionClearAllWindows_triggered();
    void on_actionPreferences_triggered();
    void on_actionWhatsThis_triggered();
    void on_actionReportBug_triggered();
    void on_actionAboutCommuni_triggered();
    void on_actionAboutQt_triggered();

    //void onCurrentConnectionChanged(IrcSession* connection);
    void onIconActivated(QSystemTrayIcon::ActivationReason reason);
    void onHighlightRequested();

private:
    MainWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0);

    Ui::MainWindow ui;
    QSystemTrayIcon* trayIcon;
    QTimer* highlightTimer;
	Controller* controller;
};

#endif // MAINWINDOW_H
